package org.bbs.demo.topic.dao;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.bbs.demo.topic.dto.PostDto;

@Mapper
public interface PostDao {

    //插入帖子记录
    @Insert("insert into bbstopic (topic_id , session_id ,user_id , topic ,text ) " +
            "values (#{topic_id} , #{session_id}, #{user_id}  ,#{topic} , #{text})")
    public int topicInsert(PostDto postDto);

    //插入标签
    @Insert("insert into tag (tagger) values (#{tagger}) ON DUPLICATE KEY UPDATE tagger = #{tagger} ")
    public int taggerInsert(String tagger);
    //插入标签和帖子对应的信息
    @Insert("insert into tag_use (topic_id, tagger ) values (#{topic_id}, #{tagger} )")
    public int taggerTopicInsert(String topic_id, String tagger);

    @Insert("insert into picture (picture_addr, topic_id) " +
            "values (#{picture_addr} , #{topic_id})")
    public int imageInsert(String picture_addr , String topic_id);
}
